package cn.itsource.fegin;

import cn.itsource.domain.Room;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component
public class RoomFeignClientFallback implements FallbackFactory<RoomFeignClient> {
    @Override
    public RoomFeignClient create(Throwable throwable) {
        return new RoomFeignClient() {
            @Override
            public Room getById(Integer id) {
                throwable.printStackTrace();
                return new Room(-1, "0000", "系统繁忙", new BigDecimal(0));
            }
        };
    }
}
